package com.qumitech.visualnovel.controller.rest;

import com.qumitech.visualnovel.model.common.BaseRsp;
import com.qumitech.visualnovel.model.common.ResultEnum;
import com.qumitech.visualnovel.controller.vo.lip.LipVo;
import com.qumitech.visualnovel.service.lip.LipService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.sql.Date;

/**
 * @Author :  ZhChNing
 * @Descriptiom :
 * @Date Created in 2018/12/28 15:32
 */
@RestController
@RequestMapping("/api/lip_config")
public class LipConfigController {
    @Autowired
    LipService lipService;

    @RequestMapping(value = "/lip", method = RequestMethod.GET)
    public BaseRsp getAdvents(@RequestParam(value = "offset",defaultValue = "1") Integer offset,
                              @RequestParam(value = "limit",defaultValue = "10") Integer limit,
                              @RequestParam(value = "startTime",required = false) Date startTime,
                              @RequestParam(value = "endTime",required = false) Date endTime,
                              @RequestParam(value = "status", required = false) Integer status
                              ){
        return new BaseRsp(ResultEnum.SUCCESS, lipService.getUserPridItem( offset,  limit,   startTime, endTime,status));
    }
    @PutMapping("/lip")
    public BaseRsp updateAdvent(@RequestBody LipVo lipVo){
        lipService.updateLipState(lipVo);
        return new BaseRsp(ResultEnum.SUCCESS);
    }
}
